Skip to content

Instantly share code, notes, and snippets.

@v0lkan
v0lkan / nginx.conf
Last active May 16, 2024 08:32
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@truemogician
truemogician / upgrading_postgresql_in_windows.md
Last active May 16, 2024 08:31
Upgrading PostgreSQL in Windows

Upgrading PostgreSQL in Windows

The official documentation for PostgreSQL provides a guide to upgrading using pg_upgrade. However, it can be a bit like a treasure hunt with hidden traps. This gist will walk you through a clear and robust method for upgrading PostgreSQL on Windows, using the upgrade from version 14 to 16 as an example.

1. Install the New Version of PostgreSQL

Before you embark on the upgrade journey, make sure you have the new version installed. This is because the pg_upgrade utility used during the upgrade process belongs to the newer version.

To get started, visit the official download page, download the installer, and run it. A word of caution: do not overwrite the old installation, as you'll need its binaries and data for the upgrade.

@code-boxx
code-boxx / 0-PHP-LIVE-CHAT.MD
Created May 31, 2023 05:44
PHP Live Chat

PHP LIVE CHAT

https://code-boxx.com/php-live-chat-websocket/

NOTES

  1. A copy of PHP Ratchet is not included. Use Composer to get the latest version - composer require cboden/ratchet.
  2. Run php 1-chat-server.php in the command line.
  3. Access 2a-chat-client.html in the web browser.

LICENSE

Copyright by Code Boxx

@CMCDragonkai
CMCDragonkai / database_typesystems.md
Last active May 16, 2024 08:29
Databases: Dependent Types in Databases

The database can make use of a more expressive type system. Specifically to enforce invariants on data integrity at the schema level. But also understanding databases from a type theoretic point of view can lead to better, safer and more expressive type systems.

You do not want to keep writing database validation code in your application boundary. That is tiring. Instead let your database do that work. After all, it is where the data is stored. It is where the data is migrated. So shouldn't it also maintain the integrity and the constraints of the data?

@atyuwen
atyuwen / opt_fsr.fxh
Last active May 16, 2024 08:28
An optimized AMD FSR implementation for Mobiles
//==============================================================================================================================
// An optimized AMD FSR's EASU implementation for Mobiles
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h
// Details can be found: https://atyuwen.github.io/posts/optimizing-fsr/
// Distributed under the MIT License. Copyright (c) 2021 atyuwen.
// -- FsrEasuSampleH should be implemented by calling shader, like following:
// AH3 FsrEasuSampleH(AF2 p) { return MyTex.SampleLevel(LinearSampler, p, 0).xyz; }
//==============================================================================================================================
void FsrEasuL(
out AH3 pix,
@soatok
soatok / matrix.md
Last active May 16, 2024 08:28
Why I Don't Trust Matrix Developers to Produce a Secure Protocol

Ever since I wrote It's Time For Furries to Stop Using Telegram, I've had a few folks ask me about my opinion on Matrix.

(I've also had a few people evangelize Matrix in my mentions. That's annoying.)

My stance on Matrix has been the same for years: I don't trust the Matrix developers to produce a secure protocol, and until they abandon Olm / Megolm in favor of something like MLS, I'm adamant about refusing to trust their team's designs.

To understand why I feel so strongly about this, you need to understand that practically exploitable vulnerabilities were found in Matrix in 2022.

It isn't enough that there were vulnerabilities found to be alarming. Vulnerabilities happen. You aren't writing software if you don't occasionally fuck up.

@pyzlnar
pyzlnar / ecto_iex_helpers.ex
Last active May 16, 2024 08:28
A few Ecto helpers that you might want to add to your .iex.exs file. Were created with PSQL in mind
import_if_available(Ecto.Query)
# alias MyApp.Repo
defmodule R do
# Old habits die hard. Take a random of something. You don't care which.
# > R.take(SomeSchema)
def take(schema_or_query) do
schema_or_query
|> limit(1)
|> Repo.one()
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 16, 2024 08:26
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maxrodrigo
maxrodrigo / git-split-and-push.sh
Last active May 16, 2024 08:26
Split a repository into batches to avoid `pack exceeds maximum allowed size` on push
# Split a repository into batches to avoid `pack exceeds maximum allowed size` on git push
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD